package cn.action;

import java.util.Date;

import javax.annotation.PostConstruct;
import javax.interceptor.Interceptors;
import javax.naming.InitialContext;

import cn.interceptor.MyEJBInterceptor;
import cn.model.User;
import cn.userBean.UserManager;

import com.opensymphony.xwork2.ActionSupport;


public class UserAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3557026508149045391L;
	
	@PostConstruct
	public void init(){
		System.out.println("action初始化");
	}
	
	
	@Override
	public String execute() throws Exception {
		InitialContext context = new InitialContext();
		UserManager userManagerBean = (UserManager)context.lookup("UserManagerBean/remote");
		
		
		User user = new User();
		user.setSex("1");
		user.setUserName("cccc");
		user.setPassword("ddddd");
		user.setBirthDay(new Date());
		userManagerBean.addUser(user);
		return SUCCESS;
	}
	
	
}
